Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: erc721 holder statistic + erc721 total supply #905

Merged
merged 9 commits into from
Sep 19, 2024

Conversation

phamphong9981
Copy link
Collaborator

@phamphong9981 phamphong9981 commented Sep 16, 2024

Erc721 holder statistic:

  • If token to new holder => holder ++
  • If token from new holder => holder --

Erc721 total supply

  • If token mint (from ZERO) => total supply ++
  • If token burn (to ZERO) => total supply --

const activities = await Erc721Handler.getErc721Activities(
0,
height,
this.logger,
[address],
trx
);
await Erc721Handler.updateErc721(activities, tokens, trx);
const erc721HolderStats: Dictionary<Erc721HolderStatistic> =
tokens.reduce((acc: Dictionary<Erc721HolderStatistic>, curr) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forEach dễ nhìn hơn

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve

await Erc721Contract.query()
const [tokens, height] = await this.getCurrentTokens(address);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore lỗi gì thế?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript define sai type. Nó define return là Erc721Contract nhưng hàm return mảng Erc721Contract[] vì insert nhiều phần tử ạ

@peara peara merged commit b61bddb into evm Sep 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants